home *** CD-ROM | disk | FTP | other *** search
- on CompileScore
- set lessonList to [:]
- set numLabels to the number of lines in the labelList
- repeat with labelNum = 1 to numLabels - 1
- set labelName to line labelNum of the labelList
- set firstCharOfLabel to char 1 of labelName
- if firstCharOfLabel = "L" then
- set pos to offset("-", labelName)
- set lessonNum to value(chars(labelName, 2, pos - 1))
- if integerp(lessonNum) then
- set lessonData to getaProp(lessonList, lessonNum)
- if voidp(lessonData) then
- set lessonData to [#firstLabel: labelName, #tryItFrame: 0]
- setaProp(lessonList, lessonNum, lessonData)
- end if
- end if
- next repeat
- end if
- if firstCharOfLabel = "T" then
- set lessonNum to value(chars(labelName, 2, length(labelName)))
- set lessonData to getaProp(lessonList, lessonNum)
- setaProp(lessonData, #tryItFrame, label(labelName))
- end if
- end repeat
- set supportList to [:]
- addProp(supportList, "Title#richText", #richText)
- addProp(supportList, "Title#field", #field)
- addProp(supportList, "Steps#field", #field)
- set numLessons to count(lessonList)
- repeat with index = 1 to numLessons
- set lessonNum to getPropAt(lessonList, index)
- set lessonPrefix to "L" & string(lessonNum) & "-"
- put "Verifying data for lesson" && string(lessonNum)
- set numSupports to count(supportList)
- repeat with supportIndex = 1 to numSupports
- set memType to getAt(supportList, supportIndex)
- set memName to lessonPrefix & getPropAt(supportList, supportIndex)
- if not DoesMemberExist(memName, memType) then
- halt()
- end if
- end repeat
- end repeat
- set numLessons to count(lessonList)
- set lessonNameList to []
- repeat with index = 1 to numLessons
- set lessonNum to getPropAt(lessonList, index)
- set lessonPrefix to "L" & string(lessonNum) & "-"
- put "Building data for lesson" && string(lessonNum)
- set stepsList to []
- set memName to lessonPrefix & "Title#field"
- set lessonName to stripWhiteSpace(the text of member memName, #both)
- append(lessonNameList, the text of member memName)
- end repeat
- putlist(lessonNameList, "@LessonListNames#field", "AuthorData")
- putlist(lessonList, "@LessonList#field", "AuthorData")
- put "Recording Score"
- set saveFrame to the frame
- set lastFrame to the lastFrame
- SaveAndClearPuppets()
- set the updateLock to 1
- beginRecording()
- repeat with index = 1 to numLessons
- set lessonNum to getPropAt(lessonList, index)
- set lessonPrefix to "L" & string(lessonNum) & "-"
- put "Recording data for lesson" && string(lessonNum)
- set lessonData to getaProp(lessonList, lessonNum)
- set labelName to getaProp(lessonData, #firstLabel)
- set hasTryIt to getaProp(lessonData, #tryItFrame) > 0
- if hasTryIt then
- set navBarName to "NavBar2"
- else
- set navBarName to "NavBar1"
- end if
- set frameNum to label(labelName)
- go(frameNum)
- Record_SS_LessonInit(navBarName)
- set stepNum to 1
- set possibleTN to "T" & string(lessonNum)
- set possibleXN to "X" & string(lessonNum)
- set possibleLN to lessonPrefix & string(stepNum)
- repeat while 1
- set labelName to the frameLabel
- if (labelName = 0) or (labelName = "W1") or (labelName = "W2") or (labelName = "K1") or (labelName = "K2") then
- if isFrameEmpty() then
- put "ERROR: Empty frame or missing required label"
- halt()
- else
- Record_SS_LessonBody(navBarName)
- end if
- next repeat
- end if
- if labelName = possibleLN then
- Record_SS_LessonStep(navBarName)
- set stepNum to stepNum + 1
- set possibleLN to lessonPrefix & string(stepNum)
- next repeat
- end if
- if labelName = possibleTN then
- go(label(labelName) - 1)
- Record_SS_LessonEnd("NavBar2")
- Record_SS_TryIt()
- exit repeat
- next repeat
- end if
- if labelName = possibleXN then
- Record_SS_ExitLesson()
- go(label(labelName) - 1)
- Record_SS_LessonEnd("NavBar1")
- exit repeat
- end if
- end repeat
- end repeat
- endRecording()
- RestorePuppets()
- go(saveFrame)
- set the updateLock to 0
- end
-
- on DoesMemberExist memName, memType
- set memNum to the number of member memName
- if memNum <= 0 then
- put "Required #" & string(memType) && "member" && QUOTE & memName & QUOTE && "missing."
- return 0
- else
- if the type of member memNum <> memType then
- put "Required member " & QUOTE & memName & QUOTE & ", " & string(member memNum) & ", is not of type #" & string(memType) & "."
- return 0
- end if
- end if
- return 1
- end
-
- on Record_SS_LessonInit navBarName
- set the frameScript to member "SS_LessonInit"
- Record_StdLessonSprites()
- set channelNum to 46
- set memberNum to the number of member navBarName
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(0, 356, 0 + 320, 356 + 12)
- updateFrame()
- end
-
- on Record_SS_LessonStep navBarName
- set the frameScript to member "SS_LessonStep"
- Record_StdLessonSprites()
- set channelNum to 46
- set memberNum to the number of member navBarName
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(0, 356, 0 + 320, 356 + 12)
- updateFrame()
- end
-
- on Record_SS_LessonBody navBarName
- set labelName to the frameLabel
- case the frameLabel of
- "W1":
- set the frameScript to member "SS_LessonBody(W1)"
- "W2":
- set the frameScript to member "SS_LessonBody(W2)"
- "K1":
- set the frameScript to member "SS_LessonBody(K1)"
- "K2":
- set the frameScript to member "SS_LessonBody(K2)"
- otherwise:
- set the frameScript to member "SS_LessonBody"
- end case
- Record_StdLessonSprites()
- set channelNum to 46
- set memberNum to the number of member navBarName
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(0, 356, 0 + 320, 356 + 12)
- updateFrame()
- end
-
- on Record_SS_LessonEnd navBarName
- set the frameScript to member "SS_LessonEnd"
- set channelNum to 46
- set memberNum to the number of member navBarName
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(0, 356, 0 + 320, 356 + 12)
- Record_StdLessonSprites()
- updateFrame()
- end
-
- on Record_SS_TryIt
- set the frameScript to member "SS_TryIt"
- Record_StdLessonSprites()
- set channelNum to 46
- set memberNum to the number of member "NavBar1"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(0, 356, 0 + 320, 356 + 12)
- updateFrame()
- end
-
- on Record_SS_ExitLesson
- set the frameScript to member "SS_ExitLesson"
- Record_StdLessonSprites()
- set channelNum to 46
- set memberNum to the number of member "NavBar1"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(0, 356, 0 + 320, 356 + 12)
- updateFrame()
- end
-
- on Record_StdLessonSprites
- set channelNum to 2
- set memberNum to the number of member "AnimBackground"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to the rect of member memberNum
- set the loc of sprite channelNum to point(0, 0)
- set channelNum to 36
- set memberNum to the number of member "LessonStepsFrame"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(0, 235, 320, 235 + 122)
- set channelNum to 39
- set memberNum to the number of member "TitleStandIn#richText"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(6, 243, 6 + 308, 243 + 16)
- set the ink of sprite channelNum to 36
- set channelNum to 37
- set memberNum to the number of member "TitleStandInShadow#richText"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(7, 244, 7 + 308, 244 + 16)
- set the ink of sprite channelNum to 36
- set channelNum to 38
- set memberNum to the number of member "CurrentLessonSteps#field"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(3, 267, 3 + 297, 267 + 84)
- set channelNum to 40
- set memberNum to the number of member "vscrollbar"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(307, 279, 307 + 11, 279 + 64)
- set channelNum to 41
- set memberNum to the number of member "Thumb"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(307, 280, 307 + 11, 280 + 9)
- set channelNum to 42
- set memberNum to the number of member "UpArrow_out"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(307, 267, 307 + 11, 267 + 12)
- set channelNum to 43
- set memberNum to the number of member "DownArrow_out"
- set the castNum of sprite channelNum to memberNum
- set the rect of sprite channelNum to rect(307, 343, 307 + 11, 343 + 12)
- end
-
- on FixScore
- put "Fixing Score"
- set saveFrame to the frame
- set lastFrame to the lastFrame
- go(1)
- SaveAndClearPuppets()
- set the updateLock to 1
- beginRecording()
- repeat with frameNum = 1 to lastFrame
- if the frameScript = the number of member "SS_LessonBody(W1)" then
- put "W1 at" && frameNum
- set the frameLabel to "W1"
- end if
- if the frameScript = the number of member "SS_LessonBody(W2)" then
- put "W2 at" && frameNum
- set the frameLabel to "W2"
- end if
- if the frameScript = the number of member "SS_LessonBody(K1)" then
- put "K1 at" && frameNum
- set the frameLabel to "K1"
- end if
- if the frameScript = the number of member "SS_LessonBody(K2)" then
- put "K2 at" && frameNum
- set the frameLabel to "K2"
- end if
- updateFrame()
- end repeat
- endRecording()
- RestorePuppets()
- go(saveFrame)
- set the updateLock to 0
- end
-